package edu.wpi.cs509.ui;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import javax.swing.JPanel;


/**
 * This frame is created by the StrategoClient and will be used to
 * display statistical information and rules.  This should be used 
 * in the future to display any generic information that we wish to
 * pop out into a new window.
 * 
 * @author jprocess
 *
 */
@SuppressWarnings("serial")
public class StrategoInfoFrame extends JFrame implements WindowListener {
	private JPanel mainPanel;
	private JPanel infoPanel;
	
	/**
	 * Constructor for the frame
	 * Displays the JPanel infoPanel
	 */
	public StrategoInfoFrame( JPanel infoPanel ) {
		addWindowListener( this );
			
		// panel we plan to display
		this.infoPanel = infoPanel;
		
		// set the initial panel to the login
		displayInfoPanel();
	}
		
	public void displayInfoPanel() {
			
		try {
			remove( mainPanel );
		} catch (NullPointerException e) {
			//ignore
		}

		// set the main panel to the login
		mainPanel = infoPanel;
		add(mainPanel);
		mainPanel.setVisible(true);
	}
	
	public JPanel getMainPanel() {
		return mainPanel;
	}
	
	@Override
	public void windowActivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosed(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosing(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeactivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeiconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowIconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowOpened(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}
